<script setup>
import { inject } from 'vue';


const myMsg = inject('myMsg')
const myStr = inject('myStr')
const setMyMsg = inject('setMyMsg')
</script>

<template>
  <div class="sonson">
    <h3>后代组件</h3>
    <p>{{ myMsg }}</p>
    <p>{{ myStr }}</p>
    <button @click="setMyMsg">调用祖先的函数</button>
  </div>
</template>

<style scoped>
  .sonson {
    border: 5px solid orange;
  }
</style>
